﻿#ifndef _OI_LT360BASE_TITLEWIDGET_HPP_
#define _OI_LT360BASE_TITLEWIDGET_HPP_

#include "OiLT360Base.hpp"

namespace Oi
{
    namespace Appl
    {

        class OI_LT360BASE_API TitleWidget : public QWidget
        {
            Q_OBJECT
        public:
            TitleWidget(QWidget * parent = Q_NULLPTR);
            ~TitleWidget();

        protected:
            void paintEvent(QPaintEvent *evt);

        private:
            OI_DISABLE_COPY(TitleWidget);
            OI_DECLARE_IMPL(TitleWidget);
        };

        class OI_LT360BASE_API TitleButton : public QWidget
        {
            Q_OBJECT
        public:
            TitleButton(bool togglable = true, QBoxLayout::Direction dir = QBoxLayout::TopToBottom, QWidget* parent = Q_NULLPTR);
            ~TitleButton();

            QAction* action();
            void setIcon(const QString path);
            void setText(const QString text);
            void setMarkWidth(int);
            void setMarkOrientation(int);
            void setBackgroundColor(const QColor bgColor);
            bool isChecked();

        public slots:
            void setChecked(bool isChecked);
            void setTouched(bool isTouched);

        signals:
            void triggered();

        protected:
            void enterEvent(QEvent *event);
            void leaveEvent(QEvent *event);
            void mousePressEvent(QMouseEvent *event);
            void mouseReleaseEvent(QMouseEvent* event);
            void paintEvent(QPaintEvent *event);

        private:
            OI_DISABLE_COPY(TitleButton);
            OI_DECLARE_IMPL(TitleButton);
        };

    }
}

#endif

